layui.define(['tree', 'jquery'], function (exports) {
    const {tree, jquery: $} = layui;
    exports('lay_tree', {
        render: function (config) {

            config = $.extend(true, {
                show_checkbox: true,
            }, config);

            tree.render({
                elem: config.elem
                , data: JSON.parse(decodeURIComponent(config.data))
                , id: $(config.elem).attr('id') //定义索引
                , showCheckbox: config.show_checkbox
            });
        }
    });
});